package cn.fyk.sso.client.two.config;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.Filter;

import cn.fyk.sso.client.two.filter.SsoClientFilter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description:	拦截设置
 * @Author:			方宇康
 * @CreateDate:		2020/1/6 9:46
 * @Version:      	1.0.0.1
 * @Company:       联通智网科技有限公司
 */
@Slf4j
@Configuration
public class FilterConfig
{
	@Bean
	public FilterRegistrationBean<Filter> filterRegistration()
	{
		log.info("FilterConfig|filterRegistration|客户端二拦截设置");
		FilterRegistrationBean registration = new FilterRegistrationBean();
		registration.setFilter(new SsoClientFilter());
		List<String> urlList = new ArrayList<>();
	    urlList.add("/*");
	    registration.setUrlPatterns(urlList);
		registration.setName("SsoClientFilter");
		registration.setOrder(1);
		return registration;
	}
}
